<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var xiaomi = {
      name: "小米手机",
      color: "红色",
      fare: function (temp, s) {
        console.log(this.color + this.name + "真热" + temp + "度" + s + "秒后爆炸");
      }
    }
    var sanxing = {
      name: "三星手机",
      color: "蓝色",
      // fare:function(){}
    }
    // 改变this指向的三个方法  call  apply  bind
    // xiaomi.fare(88, 10)
    // xiaomi.fare.call(sanxing, 66, 5)
    // apply 和call区别  传参方式不同
    xiaomi.fare.apply(sanxing, [66, 5])

    var name = "苹果手机"
    var color = "白色"

    // xiaomi.fare.call(window, 55, 3)
    xiaomi.fare.apply(window, [55, 3])
    //
    // bind 绑定this 指向  
    var oppo = {
      name: "oppor31",
      color: "红色"
    }
    var res = xiaomi.fare.bind(oppo) //先绑定this指向
    res(100, 2) //调用绑定好的返回的函数



  </script>
</body>

</html>